package com.cskaoyan.controller.wx;

import com.cskaoyan.bean.vo.BaseRespVo;
import com.cskaoyan.bean.MarketCategory;
import com.cskaoyan.bean.vo.wx.wxcatalogcurrent.WXCatalogCurrentTotalVo;
import com.cskaoyan.bean.vo.wx.wxcatalogindex.WXCatalogIndexTotalVo;
import com.cskaoyan.service.wx.WXCatalogIndexService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
// import sun.nio.cs.ext.MacArabic;


/**
 * @author Yan Dexuan
 * @since 2022/06/29 14:10
 */
@RestController
@RequestMapping("wx/catalog")
public class WXCatalogController {

    @Autowired
    WXCatalogIndexService wxCatalogIndexService;

    /**
     * 小程序分类主页，展示商品的一级目录和二级目录。
     * @return com.cskaoyan.bean.vo.BaseRespVo
     * @author Yan Dexuan
     * @since 2022/06/29 19:45
     */
    @RequestMapping("index")
    public BaseRespVo catalogIndex(){

        WXCatalogIndexTotalVo totalVo = wxCatalogIndexService.catalogIndex();

        return BaseRespVo.ok(totalVo);

    }


    /**
     * 小程序分类主页，显示用户当前点击的一级目录及其对应的二级目录。
     * @param marketCategory
     * @return com.cskaoyan.bean.vo.BaseRespVo
     * @author Yan Dexuan
     * @since 2022/06/29 19:47
     */
    @RequestMapping("current")
    public BaseRespVo catalogCurrent(MarketCategory marketCategory){

        WXCatalogCurrentTotalVo totalVo = wxCatalogIndexService.catalogCurrent(marketCategory);

        return BaseRespVo.ok(totalVo);

    }

}
